package com.tbmob.tb_h5;

import android.app.Application;

import com.bun.miitmdid.interfaces.IdSupplier;
import com.tb.mob.TbManager;
import com.tb.mob.config.TbInitConfig;

public class App extends Application {

    public static String oaid;

    @Override
    public void onCreate() {
        super.onCreate();
        initOaid();
        initTb();
    }

    //广告初始化【TbManager.init】之前执行oaid_sdk初始化操作
    private void initOaid() {
        int code = com.bun.miitmdid.core.MdidSdkHelper.InitSdk(this, true,
                new com.bun.miitmdid.interfaces.IIdentifierListener() {
                    @Override
                    public void OnSupport(boolean b, IdSupplier idSupplier) {
                        App.oaid = idSupplier.getOAID();
                    }
                });
    }

    private void initTb() {
        TbInitConfig config = new TbInitConfig.Builder()
                .appId(ConfigInfo.initAppId)
                .build();
        TbManager.init(this, config, new TbManager.IsInitListener() {
            @Override
            public void onFail(String s) {

            }

            @Override
            public void onSuccess() {

            }

            @Override
            public void onDpSuccess() {

            }
        });
    }
}
